ποΈGitΠ―ΡΠ°ποΈ
Node / meshtastic / Meshtastic-Android / files / core / repository / src / commonMain / kotlin / org / meshtastic / core / repository / AdminController.kt
Displaying Raw β’ Download
core/repository/src/commonMain/kotlin/org/meshtastic/core/repository/AdminController.kt bf929c20f274232e0eb8ddc19b2dc82403e99e5b (bf929c20) Text, 8.24 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.repository
Tff7b72import T7ee787org.meshtastic.core.model.Position
Tff7b72import T7ee787org.meshtastic.proto.Channel
Tff7b72import T7ee787org.meshtastic.proto.Config
Tff7b72import T7ee787org.meshtastic.proto.HamParameters
Tff7b72import T7ee787org.meshtastic.proto.ModuleConfig
Tff7b72import T7ee787org.meshtastic.proto.User
T8b949e/**
* Device configuration and control operations.
*
* Mirrors the SDK's `AdminApi` interface β local and remote configuration, channel management, owner identity, device
* lifecycle commands, and batch edit sessions. When the SDK is adopted, this interface becomes the adapter boundary:
* implementations delegate to `RadioClient.admin`.
*
* @see RadioController which extends this interface for backward compatibility
*/
Tf0883e@SuppressTb4b4b4(Ta5d6ff"Ta5d6ffTooManyFunctionsTa5d6ff"Tb4b4b4)
Tff7b72interface T56d364AdminController Tb4b4b4{
T8b949e// ββ Local configuration βββββββββββββββββββββββββββββββββββββββββββββββββ
T8b949e/**
* Updates the local radio configuration.
*
* Fire-and-forget by design: the device is the source of truth. Local persistence is an optimistic cache that will
* self-heal on next config refresh.
*/
Tff7b72suspend Tff7b72fun Td2a8ffsetLocalConfigTb4b4b4(Te6edf3configTb4b4b4: Te6edf3ConfigTb4b4b4)
T8b949e/** Updates a local radio channel. Same fire-and-forget contract as [setLocalConfig]. */
Tff7b72suspend Tff7b72fun Td2a8ffsetLocalChannelTb4b4b4(Te6edf3channelTb4b4b4: Te6edf3ChannelTb4b4b4)
T8b949e// ββ Remote configuration ββββββββββββββββββββββββββββββββββββββββββββββββ
T8b949e/** Updates the owner (user info) on a remote node. */
Tff7b72suspend Tff7b72fun Td2a8ffsetOwnerTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3userTb4b4b4: Te6edf3UserTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/**
* Enables amateur-radio (ham) mode on a node via `AdminMessage.set_ham_mode`.
*
* Must target only the locally connected node β firmware ham onboarding is a local operation; the implementation
* ignores requests for any other node. The firmware handler rewrites the owner (long_name = call_sign), flips
* `is_licensed`, disables encryption, applies [HamParameters.tx_power]/[HamParameters.frequency] to the LoRa config
* verbatim, and reboots. The implementation echoes the local node's current LoRa values into those two fields so a
* re-send never wipes the node's overrides; caller-supplied [HamParameters.tx_power]/[HamParameters.frequency] are
* ignored. Intentionally absent from [AdminEditScope]: ham enablement is not a batch-edit operation.
*/
Tff7b72suspend Tff7b72fun Td2a8ffsetHamModeTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3hamParametersTb4b4b4: Te6edf3HamParametersTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Updates the general configuration on a remote node. */
Tff7b72suspend Tff7b72fun Td2a8ffsetConfigTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3configTb4b4b4: Te6edf3ConfigTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Updates a module configuration on a remote node. */
Tff7b72suspend Tff7b72fun Td2a8ffsetModuleConfigTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3configTb4b4b4: Te6edf3ModuleConfigTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Updates a channel configuration on a remote node. */
Tff7b72suspend Tff7b72fun Td2a8ffsetRemoteChannelTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3channelTb4b4b4: Te6edf3ChannelTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Sets a fixed position on a remote node. */
Tff7b72suspend Tff7b72fun Td2a8ffsetFixedPositionTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3positionTb4b4b4: Te6edf3PositionTb4b4b4)
T8b949e/** Updates the notification ringtone on a remote node. */
Tff7b72suspend Tff7b72fun Td2a8ffsetRingtoneTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3ringtoneTb4b4b4: Tffa657StringTb4b4b4)
T8b949e/** Updates the canned messages configuration on a remote node. */
Tff7b72suspend Tff7b72fun Td2a8ffsetCannedMessagesTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3messagesTb4b4b4: Tffa657StringTb4b4b4)
T8b949e/**
* Syncs a node's real-time clock to the phone's current time via `AdminMessage.set_time_only`.
*
* Mirrors the Python CLI's `Node.setTime`: an accurate epoch-seconds timestamp is sent so a remote node whose RTC
* has drifted can be corrected without an on-site visit. Fire-and-forget β the firmware applies the value without
* an admin response (the routing ACK confirms delivery).
*/
Tff7b72suspend Tff7b72fun Td2a8ffsetTimeTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e// ββ Remote queries ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
T8b949e/** Requests the current owner (user info) from a remote node. */
Tff7b72suspend Tff7b72fun Td2a8ffgetOwnerTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Requests a specific configuration section from a remote node. */
Tff7b72suspend Tff7b72fun Td2a8ffgetConfigTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3configTypeTb4b4b4: Tffa657IntTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Requests a module configuration section from a remote node. */
Tff7b72suspend Tff7b72fun Td2a8ffgetModuleConfigTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3moduleConfigTypeTb4b4b4: Tffa657IntTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Requests a specific channel configuration from a remote node. */
Tff7b72suspend Tff7b72fun Td2a8ffgetChannelTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3indexTb4b4b4: Tffa657IntTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Requests the current ringtone from a remote node. */
Tff7b72suspend Tff7b72fun Td2a8ffgetRingtoneTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Requests the current canned messages from a remote node. */
Tff7b72suspend Tff7b72fun Td2a8ffgetCannedMessagesTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Requests the hardware connection status from a remote node. */
Tff7b72suspend Tff7b72fun Td2a8ffgetDeviceConnectionStatusTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e// ββ Device lifecycle ββββββββββββββββββββββββββββββββββββββββββββββββββββ
T8b949e/** Commands a node to reboot. */
Tff7b72suspend Tff7b72fun Td2a8ffrebootTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Commands a node to reboot into DFU mode. */
Tff7b72suspend Tff7b72fun Td2a8ffrebootToDfuTb4b4b4(Te6edf3nodeNumTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Initiates an OTA reboot request. */
Tff7b72suspend Tff7b72fun Td2a8ffrequestRebootOtaTb4b4b4(Te6edf3requestIdTb4b4b4: Tffa657IntTb4b4b4, Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3modeTb4b4b4: Tffa657IntTb4b4b4, Te6edf3hashTb4b4b4: Te6edf3ByteArray?Tb4b4b4)
T8b949e/** Commands a node to shut down. */
Tff7b72suspend Tff7b72fun Td2a8ffshutdownTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Performs a factory reset on a node. */
Tff7b72suspend Tff7b72fun Td2a8fffactoryResetTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Resets the NodeDB on a node. */
Tff7b72suspend Tff7b72fun Td2a8ffnodedbResetTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3packetIdTb4b4b4: Tffa657IntTb4b4b4, Te6edf3preserveFavoritesTb4b4b4: Tffa657BooleanTb4b4b4)
T8b949e// ββ Batch edit ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
T8b949e/**
* Runs [block] inside a begin/commit edit-settings transaction on [destNum].
*
* The session is opened before [block] runs and committed after it returns normally, so callers can neither forget
* to commit nor leak a half-open session. Operations inside the block target [destNum] implicitly. Mirrors the
* SDK's `AdminApi.editSettings { }`.
*
* All admin packets for the session β begin, the [block]'s writes, and commit β are issued from the calling
* coroutine, which is required for the firmware to associate them with one transaction.
*/
Tff7b72suspend Tff7b72fun Td2a8ffeditSettingsTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3blockTb4b4b4: Te6edf3suspend Te6edf3AdminEditScopeTb4b4b4.Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4)
Tb4b4b4}
T8b949e/**
* Configuration operations valid inside an [AdminController.editSettings] transaction, scoped to a single destination
* node so callers don't repeat the node number or manage packet IDs. Mirrors the SDK's `AdminEdit`.
*/
Tff7b72interface T56d364AdminEditScope Tb4b4b4{
T8b949e/** Updates the owner (user info) on the session's node. */
Tff7b72suspend Tff7b72fun Td2a8ffsetOwnerTb4b4b4(Te6edf3userTb4b4b4: Te6edf3UserTb4b4b4)
T8b949e/** Updates the general configuration on the session's node. */
Tff7b72suspend Tff7b72fun Td2a8ffsetConfigTb4b4b4(Te6edf3configTb4b4b4: Te6edf3ConfigTb4b4b4)
T8b949e/** Updates a module configuration on the session's node. */
Tff7b72suspend Tff7b72fun Td2a8ffsetModuleConfigTb4b4b4(Te6edf3configTb4b4b4: Te6edf3ModuleConfigTb4b4b4)
T8b949e/** Updates a channel configuration on the session's node. */
Tff7b72suspend Tff7b72fun Td2a8ffsetChannelTb4b4b4(Te6edf3channelTb4b4b4: Te6edf3ChannelTb4b4b4)
T8b949e/** Sets a fixed position on the session's node. */
Tff7b72suspend Tff7b72fun Td2a8ffsetFixedPositionTb4b4b4(Te6edf3positionTb4b4b4: Te6edf3PositionTb4b4b4)
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.05s